<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
	<th:block th:include="include :: header('红包列表')" />
</head>
<body class="gray-bg">
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<div class="select-list">
						<ul>
							<li>
								红包名称：<input type="text" name="hbName"/>
							</li>

						

							

							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
							</li>
						</ul>
					</div>
				</form>
			</div>
			
	        <div class="btn-group-sm" id="toolbar" role="group">
				<a class="btn btn-success" onclick="packetsAdd()" shiro:hasPermission="Packets:packets:add">
					<i class="fa fa-plus"></i> 添加新红包
				</a>
				
				<a class="btn btn-danger btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="Packets:packets:remove">
					<i class="fa fa-remove"></i> 删除
				</a>
				
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('Packets:packets:edit')}]];
        var removeFlag = [[${@permission.hasPermi('Packets:packets:remove')}]];
        var prefix = ctx + "Packets/packets";

        $(function() {
            var options = {
                url: prefix + "/list",
                createUrl: prefix + "/add",
                updateUrl: prefix + "/edit/{id}",
                removeUrl: prefix + "/remove",
				exportUrl: prefix + "/export",
                modalName: "红包",
		        showExport: true,
                columns: [{
		            checkbox: true
		        },
				{
					field : 'id', 
					title : 'id',
					visible: false
				},
				{
					field : 'hbName', 
					title : '红包名称',
					sortable: true
				},
				{
					field : 'hbNumber', 
					title : '红包数量',
					sortable: true
				},
				
				{
					field : 'jine', 
					title : '金额',
					sortable: true
				},
				{
					field : 'manjian', 
					title : '满减条件金额',
					sortable: true
				},
				{
					field : 'selectedControl', 
					title : '手机端是否显示',
					sortable: true
				},
				{
					field : 'type', 
					title : '3001红包 3003优惠卷',
					sortable: true
				},
				
				
				{
					field : 'gqDate', 
					title : '过期时间',
					sortable: true
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="packetsUpdate(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            }
		        }]
            };
            $.table.init(options);          
        });
        
        function packetsUpdate(id) {
        	$.modal.open('查看红包', prefix + "/edit/" + id, '1300', '800');			
		}
        
        function packetsAdd() {
        	$.modal.open('添加红包', prefix + "/add" , '1300', '800');			
		}
    </script>
</body>
</html>